﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:system="clr-namespace:System;assembly=mscorlib" 
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                    mc:Ignorable="d">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Images\Brushes.xaml" />
    </ResourceDictionary.MergedDictionaries>


    <!-- Button -->
    <Style TargetType="{x:Type Button}">
        <Setter Property="TextOptions.TextHintingMode" Value="Animated" />
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}" />
        <Setter Property="Background" Value="{StaticResource ControlBackgroundNormal}"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusLine}"/>
        <Setter Property="BorderThickness" Value="{StaticResource BorderThicknessButton}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}"/>
        <Setter Property="Padding" Value="{StaticResource MarginContentButton}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.2" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="PressedElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="0.25" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="PressedElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="BorderVisual" Storyboard.TargetProperty="(UIElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="BorderPressed" Storyboard.TargetProperty="(UIElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="HighlightElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="0.5" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="ContentHost" Storyboard.TargetProperty="(UIElement.Opacity)" To="0.75" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused"/>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement" Background="{StaticResource DisabledBrush}" CornerRadius="2" Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}" BorderThickness="0,0,1,1" CornerRadius="2" />
                        </Border>
                        <Border x:Name="BorderVisual" Background="Transparent" CornerRadius="4" BorderBrush="{StaticResource BorderBrushVisual}" BorderThickness="{StaticResource ThicknessButtonVisual}" />
                        <Border x:Name="BorderPressed" Background="Transparent" CornerRadius="4" BorderBrush="{StaticResource ControlPressedVisualBrush}" BorderThickness="{StaticResource ThicknessButtonVisual}" Opacity="0" />
                        <Border x:Name="NormalElement" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="2" Effect="{StaticResource ControlShadowEffect}"
                                BorderThickness="{TemplateBinding BorderThickness}" Margin="{StaticResource MarginBorderButton}"/>
                        <Border x:Name="MouseOverElement" BorderBrush="{StaticResource ControlActiveBorderBrush}" Background="{StaticResource ControlBackgroundOver}" CornerRadius="2" Opacity="0" 
                                BorderThickness="{TemplateBinding BorderThickness}" Margin="{StaticResource MarginBorderButtonOver}"/>
                        <Border x:Name="PressedElement" Background="{StaticResource ControlBackgroundPressed}" CornerRadius="2" Opacity="0" BorderThickness="{TemplateBinding BorderThickness}"
                                BorderBrush="{StaticResource ControlActiveBorderBrush}" Margin="{StaticResource MarginBorderButton}"/>
                        <Border x:Name="HighlightElement" BorderBrush="{StaticResource ControlHighlight}" BorderThickness="{StaticResource BorderThicknessButtonOutline}" CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                        </ContentPresenter>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- ToggleButton -->
    <Style TargetType="{x:Type ToggleButton}">
        <Setter Property="TextOptions.TextHintingMode" Value="Animated" />
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}" />
        <Setter Property="Background" Value="{StaticResource ControlBackgroundNormal}"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusLine}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="HighlightElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="0.5" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="ContentHost" Storyboard.TargetProperty="(UIElement.Opacity)" To="0.75" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="NormalElement" />
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="HighlightElement" />
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="CheckedElement" />
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="MouseOverElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked" />
                                <VisualState x:Name="Indeterminate" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement" Background="{StaticResource DisabledBrush}" CornerRadius="2" Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}" BorderThickness="0,0,1,1" CornerRadius="2" />
                        </Border>
                        <Border x:Name="NormalElement" Background="{StaticResource ControlBackgroundNormal}" CornerRadius="2" Effect="{StaticResource ControlShadowEffect}" />
                        <Border x:Name="CheckedElement" CornerRadius="2.5" BorderBrush="#D0494a4d" BorderThickness="1" Margin="0,-1,0,-1" Opacity="0"
                                Background="{StaticResource ToggleButtonChecked}">
                            <Border BorderBrush="#70303030" BorderThickness="1,1,0,0" CornerRadius="2">
                                <Border BorderBrush="#30303030" BorderThickness="1" CornerRadius="1.5">
                                    <Border BorderBrush="#10303030" BorderThickness="1,1,0,0" CornerRadius="1" />
                                </Border>
                            </Border>
                        </Border>
                        <Border x:Name="MouseOverElement" Background="{StaticResource ControlBackgroundLine}" CornerRadius="2" Opacity="0" />
                        <Border x:Name="HighlightElement" BorderBrush="{StaticResource ControlHighlight}" BorderThickness="{StaticResource BorderThicknessButtonOutline}" CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect Color="{StaticResource ColorForegroundShadowColor}" Direction="-90" BlurRadius="1" ShadowDepth="1" Opacity="0.5" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                        <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="0" Opacity="0" RadiusX="1" RadiusY="1" Stroke="{StaticResource FocusVisualBrush}" StrokeThickness="1" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- ToggleButton - нестандартный стиль -->
    <Style x:Key="ToggleButton_Occupado" TargetType="{x:Type ToggleButton}">
        <Setter Property="Background" Value="#FF1F3B53"/>
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}"/>
        <Setter Property="Padding" Value="3"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush" Value="{StaticResource ToggleButtonBorderBrush_forOccupado}"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusLine_Occupado}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed"/>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetProperty="(UIElement.Opacity)" To=".4" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.2"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.2" To="-180.709" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)" Storyboard.TargetName="path"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused"/>
                                <VisualState x:Name="Unfocused"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" 
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" 
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Visibility="Collapsed"/>
                        <Ellipse StrokeThickness="3" Stroke="{TemplateBinding BorderBrush}"/>
                        <Path Data="M0.5,0.5 L68.5,0.5 C68.5,19.277683 53.277683,34.5 34.5,34.5 C15.722319,34.5 0.49999958,19.277683 0.5,0.5 z" Margin="3,3,3,37" Stretch="Fill" 
                              UseLayoutRounding="False" RenderTransformOrigin="0.5,0.5" Cursor="Hand" Fill="{StaticResource ToggleButtonBackgroundON_forOccupado}"
                              Stroke="{StaticResource ToggleButtonBorderBrushON_forOccupado}">
                            <Path.RenderTransform>
                                <ScaleTransform ScaleY="-1"/>
                            </Path.RenderTransform>
                        </Path>
                        <Path Data="M0.5,0.5 L68.5,0.5 C68.5,19.277683 53.277683,34.5 34.5,34.5 C15.722319,34.5 0.49999958,19.277683 0.5,0.5 z" Margin="3,37,3,3" Stretch="Fill" 
                              UseLayoutRounding="False" Cursor="Hand" Fill="{StaticResource ToggleButtonBackgroundOFF_forOccupado}" 
                              Stroke="{StaticResource ToggleButtonBorderBrushOFF_forOccupado}"/>
                        
                        <Path x:Name="path" Data="M0.5,0.5 L68.5,0.5 C68.5,19.277683 53.277683,34.5 34.5,34.5 C15.722319,34.5 0.49999958,19.277683 0.5,0.5 z" Margin="3,37,3,3" 
                              Stretch="Fill" UseLayoutRounding="False" RenderTransformOrigin="0.5,-0.005" Fill="{StaticResource ToggleButtonBackBackground_forOccupado}"
                              Stroke="{StaticResource ToggleButtonBackBorderBrush_forOccupado}">
                            <Path.RenderTransform>
                                <RotateTransform/>
                            </Path.RenderTransform>
                        </Path>
                        <Ellipse Margin="35" Width="5" Height="5">
                            <Ellipse.Fill>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FF272727" Offset="0"/>
                                    <GradientStop Color="#FF525252" Offset="1"/>
                                </LinearGradientBrush>
                            </Ellipse.Fill>
                            <Ellipse.Stroke>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FF353535" Offset="1"/>
                                    <GradientStop Color="#FF1B1B1B"/>
                                </LinearGradientBrush>
                            </Ellipse.Stroke>
                        </Ellipse>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- CheckBox -->
    <Style TargetType="{x:Type CheckBox}">
        <Setter Property="Background" Value="{StaticResource ControlBackgroundNormal}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="4,0" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusLine_Occupado}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CheckBox}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="HoverOn">
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="background_checkbox"
                                            Duration="0:0:0.3" To="{StaticResource BorderBrushGradientColor1}"/>
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="background_checkbox"
                                            Duration="0:0:0.3" To="{StaticResource BorderBrushGradientColor2}"/>
                        </Storyboard>
                        <Storyboard x:Key="HoverOff">
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="background_checkbox"
                                            Duration="0:0:0.3" To="{StaticResource BorderBrushSolidColor}"/>
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="background_checkbox"
                                            Duration="0:0:0.3" To="{StaticResource BorderBrushSolidColor}"/>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <BulletDecorator Background="Transparent">
                        <BulletDecorator.Bullet>
                            <Grid Width="16" Height="16">
                                <Rectangle Height="14" Width="14" x:Name="background_checkbox" Stroke="{TemplateBinding BorderBrush}"
                                           Fill="{TemplateBinding Background}"/>
                                <Path x:Name="check_icon" Opacity="0" Stretch="Fill" 
                                      Data="M102.03442,598.79645 L105.22962,597.78918 L106.95686,599.19977 C106.95686,599.19977 113.77958,590.53656 113.77958,590.53656 C113.77958,590.53656 107.40649,603.79431 107.40649,603.79431 z" 
                                      Fill="{DynamicResource MyItemColor}" Height="10" Width="11"/>
                                <Rectangle Height="7" Width="7" x:Name="background_null_checkbox" Fill="{StaticResource ControlBackgroundOver}" Opacity="0"/>
                                <Rectangle Height="12" Width="12" x:Name="background_disabled_checkbox" Fill="{StaticResource DisabledBrush}" 
                                           Stroke="{StaticResource DisabledBorderBrush}" StrokeThickness="1" Opacity="0"/>
                            </Grid>
                        </BulletDecorator.Bullet>
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" 
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
                    </BulletDecorator>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="check_icon" Property="Opacity" Value="1"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="{x:Null}">
                            <Setter TargetName="background_null_checkbox" Property="Opacity" Value="1"/>
                            <Setter Property="Opacity" Value="0.9"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="background_disabled_checkbox" Property="Opacity" Value="1"/>
                            <Setter Property="Opacity" Value="0.72"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOff}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- RadioButton -->
    <Style TargetType="{x:Type RadioButton}">
        <Setter Property="Background" Value="{StaticResource ControlBackgroundNormal}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}" />
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusLine_Occupado}"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="4 0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RadioButton}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="HoverOn">
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="background_radiobutton"
                                            Duration="0:0:0.3" To="{StaticResource BorderBrushGradientColor1}"/>
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="background_radiobutton"
                                            Duration="0:0:0.3" To="{StaticResource BorderBrushGradientColor2}"/>
                        </Storyboard>
                        <Storyboard x:Key="HoverOff">
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="background_radiobutton"
                                            Duration="0:0:0.3" To="{StaticResource BorderBrushSolidColor}"/>
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="background_radiobutton"
                                            Duration="0:0:0.3" To="{StaticResource BorderBrushSolidColor}"/>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <BulletDecorator Background="Transparent">
                        <BulletDecorator.Bullet>
                            <Grid Width="16" Height="16">
                                <Ellipse Height="14" Margin="1" x:Name="background_radiobutton" Width="14" Fill="{TemplateBinding Background}"
                                         Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1"/>
                                <Ellipse Height="8" Width="8" x:Name="bullet_checked_radiobutton" Fill="{StaticResource ControlBackgroundOver}" Opacity="0"
                                         Stroke="Transparent" StrokeThickness="1"/>
                                <Ellipse Height="12" Width="12" x:Name="bullet_disabled_radiobutton" Opacity="0"
                                         Fill="{StaticResource DisabledBrush}" Stroke="{StaticResource DisabledBorderBrush}" StrokeThickness="1"/>
                            </Grid>
                        </BulletDecorator.Bullet>
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" 
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
                    </BulletDecorator>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="bullet_checked_radiobutton" Property="Opacity" Value="1"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="{x:Null}">
                            <Setter TargetName="bullet_checked_radiobutton" Property="Opacity" Value="1"/>
                            <Setter TargetName="bullet_checked_radiobutton" Property="Fill" Value="Transparent"/>
                            <Setter TargetName="bullet_checked_radiobutton" Property="Stroke" Value="{StaticResource ControlBackgroundOver}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="bullet_disabled_radiobutton" Property="Opacity" Value="1"/>
                            <Setter Property="Opacity" Value="0.72"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOff}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- TextBox -->
    <Style TargetType="{x:Type TextBox}" BasedOn="{x:Null}">
        <Setter Property="Background" Value="{StaticResource ControlLightBackground}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}" />
        <Setter Property="CaretBrush" Value="{StaticResource ControlBackgroundOver}"/>
        <Setter Property="AllowDrop" Value="True"/>
        <Setter Property="Height" Value="34"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="5"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBox}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="HoverOn">
                            <DoubleAnimation Duration="0:0:0.4" Storyboard.TargetName="txb_mouseOver1" Storyboard.TargetProperty="(UIElement.Opacity)" To="1" />
                            <DoubleAnimation Duration="0:0:0" Storyboard.TargetName="txb_mouseOver2" Storyboard.TargetProperty="(UIElement.Opacity)" To="1" />
                            <ColorAnimation Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="txb_border"
                                            Duration="0:0:0" To="Transparent"/>
                            <ColorAnimation Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="txb_border"
                                            Duration="0:0:0" To="Transparent"/>
                        </Storyboard>
                        <Storyboard x:Key="HoverOff">
                            <DoubleAnimation Duration="0:0:0.4" Storyboard.TargetName="txb_mouseOver1" Storyboard.TargetProperty="(UIElement.Opacity)" To="0" />
                            <DoubleAnimation Duration="0:0:0" Storyboard.TargetName="txb_mouseOver2" Storyboard.TargetProperty="(UIElement.Opacity)" To="0" BeginTime="0:0:0.4" />
                            <ColorAnimation Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="txb_border"
                                            Duration="0:0:0" To="{StaticResource BorderLightBrushGradientColor1}" BeginTime="0:0:0.4"/>
                            <ColorAnimation Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="txb_border"
                                            Duration="0:0:0" To="{StaticResource BorderLightBrushGradientColor2}" BeginTime="0:0:0.4"/>
                        </Storyboard>
                        <Storyboard x:Key="FocusOn">
                            <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="txb_border"
                                            Duration="0:0:0.4" To="{StaticResource BorderBrushGradientColor1}"/>
                            <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="txb_border"
                                            Duration="0:0:0.4" To="{StaticResource BorderBrushGradientColor2}"/>
                        </Storyboard>
                        <Storyboard x:Key="FocusOff">
                            <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="txb_border"
                                            Duration="0:0:0.4" To="{StaticResource BorderBrushSolidColor}"/>
                            <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="txb_border"
                                            Duration="0:0:0.4" To="{StaticResource BorderBrushSolidColor}"/>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid>
                        <Border x:Name="txb_mouseOver2" Background="{TemplateBinding Background}" Opacity="0" CornerRadius="4" />
                        <Border x:Name="txb_mouseOver1" Background="{StaticResource ControlBackgroundLine}" Opacity="0" CornerRadius="4" />
                        <Border x:Name="txb_border" Background="{TemplateBinding Background}" CornerRadius="4" 
                            BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                            <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOff}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" TargetName="txb_border" Value="{StaticResource DisabledBrush}"/>
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            <Setter Property="Opacity" Value="0.85"/>
                            <Setter TargetName="txb_border" Property="BorderBrush" Value="{StaticResource DisabledBrush}"/>
                            <Setter TargetName="txb_border" Property="BorderThickness" Value="1"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource FocusOn}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource FocusOff}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- ScrollBar -->
    <Style TargetType="{x:Type ScrollBar}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollBar}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid x:Name="GridScrollBar" Width="16" Background="{TemplateBinding Background}">
                            <Grid.RowDefinitions>
                                <RowDefinition MaxHeight="16"/>
                                <RowDefinition/>
                                <RowDefinition MaxHeight="16"/>
                            </Grid.RowDefinitions>
                            <RepeatButton x:Name="PageUpButton" Grid.Row="0" Command="ScrollBar.LineUpCommand" Style="{DynamicResource RepeatButtonArrowScrollBar}"/>
                            <Track x:Name="PART_Track" Grid.Row="1" Orientation="Vertical" IsDirectionReversed="True">
                                <Track.Thumb>
                                    <Thumb Style="{DynamicResource ThumbScrollBar}"/>
                                </Track.Thumb>
                                <Track.DecreaseRepeatButton>
                                    <RepeatButton x:Name="DecreaseRepeatButton" Command="ScrollBar.PageUpCommand" Style="{DynamicResource RepeatButtonPageScrollBar}"/>
                                </Track.DecreaseRepeatButton>
                                <Track.IncreaseRepeatButton>
                                    <RepeatButton x:Name="IncreaseRepeatButton" Command="ScrollBar.PageDownCommand" Style="{DynamicResource RepeatButtonPageScrollBar}"/>
                                </Track.IncreaseRepeatButton>
                            </Track>
                            <RepeatButton x:Name="PageDownButton" Grid.Row="2" Command="ScrollBar.LineDownCommand" Style="{DynamicResource RepeatButtonArrowScrollBar}">
                                <RepeatButton.LayoutTransform>
                                    <RotateTransform Angle="180"/>
                                </RepeatButton.LayoutTransform>
                            </RepeatButton>
                        </Grid>
                    </Border>

                    <ControlTemplate.Triggers>
                        <Trigger Property="Orientation" Value="Horizontal">
                            <Setter Property="LayoutTransform" TargetName="GridScrollBar">
                                <Setter.Value>
                                    <RotateTransform Angle="-90"/>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="PART_Track" Property="Orientation" Value="Vertical"/>
                            <Setter Property="Command" Value="ScrollBar.LineRightCommand" TargetName="IncreaseRepeatButton"/>
                            <Setter Property="Command" Value="ScrollBar.LineLeftCommand" TargetName="DecreaseRepeatButton"/>
                            <Setter Property="Command" Value="ScrollBar.PageRightCommand" TargetName="PageDownButton"/>
                            <Setter Property="Command" Value="ScrollBar.PageLeftCommand" TargetName="PageUpButton"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="RepeatButtonArrowScrollBar" TargetType="{x:Type RepeatButton}" BasedOn="{x:Null}">
        <Setter Property="Height" Value="16"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <ControlTemplate.Resources>

                        <Geometry x:Key="path">F1 M 23.9063,22.5L 21.9063,24.5L 14.9063,31.75L 14.9063,25.25L 23.9063,15.75L 32.9063,25.25L 32.9063,31.75L 25.9063,24.5L 23.9063,22.5 Z</Geometry>
                    </ControlTemplate.Resources>
                    <Grid>
                        <Border x:Name="brd" Background="Transparent"/>
                        <Path x:Name="RepeatButtonArrow" Fill="{StaticResource NormalBrushScrollBar}" 
                              Data="{StaticResource path}"
                              StrokeStartLineCap="Round" StrokeEndLineCap="Round" Stretch="Fill" UseLayoutRounding="False"
                              HorizontalAlignment="Center" VerticalAlignment="Center" Height="8" Width="8"/>
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" 
                                          Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="RepeatButtonArrow" Property="Fill" Value="{StaticResource HoverBrushScrollBar}"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="RepeatButtonArrow" Property="Fill" Value="#FFF"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="RepeatButtonArrow" Property="Fill" Value="{StaticResource DisabledBrushScrollBar}"/>
                            <Setter TargetName="RepeatButtonArrow" Property="Opacity" Value="0.72"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ThumbScrollBar" TargetType="{x:Type Thumb}">
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="HoverOn">
                            <DoubleAnimation Duration="0:0:0.3" Storyboard.TargetName="hoverRect_thumb" Storyboard.TargetProperty="(UIElement.Opacity)" To="1" />
                        </Storyboard>
                        <Storyboard x:Key="HoverOff">
                            <DoubleAnimation Duration="0:0:0.3" Storyboard.TargetName="hoverRect_thumb" Storyboard.TargetProperty="(UIElement.Opacity)" To="0" />
                        </Storyboard>
                        <Storyboard x:Key="PressedOn">
                            <DoubleAnimation Duration="0:0:0.3" Storyboard.TargetName="pressedRect_thumb" Storyboard.TargetProperty="(UIElement.Opacity)" To="1" />
                        </Storyboard>
                        <Storyboard x:Key="PressedOff">
                            <DoubleAnimation Duration="0:0:0.3" Storyboard.TargetName="pressedRect_thumb" Storyboard.TargetProperty="(UIElement.Opacity)" To="0" />
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid>
                        <Rectangle x:Name="rect_thumb" RadiusX="4" RadiusY="4" Fill="{DynamicResource MyItemColor}" Width="8"/>
                        <Rectangle x:Name="hoverRect_thumb" RadiusX="4" RadiusY="4" Fill="{StaticResource ScrollBarThumbBackground}" Width="8" Opacity="0" />
                        <Rectangle x:Name="pressedRect_thumb" Fill="{StaticResource ScrollBarThumbPressedBackground}" RadiusX="4" RadiusY="4" Width="8" Opacity="0" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOff}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="IsDragging" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource PressedOn}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource PressedOff}"/>
                            </Trigger.ExitActions>
                            <Setter TargetName="rect_thumb" Property="Fill" Value="{StaticResource ScrollBarThumbPressedBackground}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="rect_thumb" Property="Fill" Value="{StaticResource DisabledBrushScrollBar}"/>
                            <Setter TargetName="rect_thumb" Property="Opacity" Value="0.72"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="RepeatButtonPageScrollBar" TargetType="{x:Type RepeatButton}">
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="Transparent"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- ComboBox -->
    <Style TargetType="{x:Type ToggleButton}" x:Key="ComboBoxToggleButton">
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="HoverOn">
                            <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="Border"
                                Duration="0:0:0.4" To="{StaticResource BorderBrushGradientColor1}"/>
                            <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="Border"
                                Duration="0:0:0.4" To="{StaticResource BorderBrushGradientColor2}"/>
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="ArrowDown"
                                Duration="0:0:0.4" To="{StaticResource BorderBrushGradientColor2}"/>
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="ArrowDown"
                                Duration="0:0:0.4" To="{StaticResource BorderBrushGradientColor2}"/>
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="ArrowUp"
                                Duration="0:0:0.4" To="{StaticResource BorderBrushGradientColor2}"/>
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="ArrowUp"
                                Duration="0:0:0.4" To="{StaticResource BorderBrushGradientColor2}"/>
                        </Storyboard>
                        <Storyboard x:Key="HoverOff">
                            <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="Border"
                                            Duration="0:0:0.4" To="{StaticResource BorderBrushSolidColor}"/>
                            <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="Border"
                                            Duration="0:0:0.4" To="{StaticResource BorderBrushSolidColor}"/>
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="ArrowDown"
                                Duration="0:0:0.4" To="#DDDEEE"/>
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="ArrowDown"
                                Duration="0:0:0.4" To="#DDDDDD"/>
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="ArrowUp"
                                Duration="0:0:0.4" To="{StaticResource ArrowBrushComboBox}"/>
                            <ColorAnimation Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="ArrowUp"
                                Duration="0:0:0.4" To="{StaticResource ArrowBrushComboBox}"/>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Border Grid.ColumnSpan="2" CornerRadius="6"
                            BorderThickness="{Binding BorderThickness, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}, Mode=FindAncestor}}" 
                            BorderBrush="{Binding BorderBrush, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}, Mode=FindAncestor}}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="24" />
                            </Grid.ColumnDefinitions>
                            <Border x:Name="Border" Grid.ColumnSpan="2" CornerRadius="5" Background="{StaticResource ControlBackgroundNormal}" 
                                    BorderBrush="{StaticResource ControlBorderBrush}" BorderThickness="1" />
                            <Border x:Name="BorderToggle" Grid.Column="0" CornerRadius="3,0,0,3" 
                                    Background="{Binding Background, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}, Mode=FindAncestor}}"
                                    BorderBrush="{StaticResource ControlBorderBrush}" Margin="1" BorderThickness="0,0,1,0" />
                            <Grid Grid.Column="1">
                                <Path x:Name="ArrowDown" HorizontalAlignment="Center" VerticalAlignment="Center"
                                      Data="M -2 0 L 2 4 L 6 0 Z" Margin="0,8,0,0">
                                    <Path.Fill>
                                        <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
                                            <GradientStop Color="{StaticResource ArrowBrushComboBox}" Offset="0.204" />
                                            <GradientStop Color="{StaticResource ArrowBrushComboBox}" Offset="0.864" />
                                        </LinearGradientBrush>
                                    </Path.Fill>
                                </Path>
                                <Path x:Name="ArrowUp" HorizontalAlignment="Center" VerticalAlignment="Center"
                                      Data="M -2 4 L 2 0 L 6 4 Z" Margin="0,0,0,8">
                                    <Path.Fill>
                                        <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
                                            <GradientStop Color="{StaticResource ArrowBrushComboBox}" Offset="0.204" />
                                            <GradientStop Color="{StaticResource ArrowBrushComboBox}" Offset="0.864" />
                                        </LinearGradientBrush>
                                    </Path.Fill>
                                </Path>
                            </Grid>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOff}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource DisabledBrush}" />
                            <Setter TargetName="BorderToggle" Property="Background" Value="{StaticResource DisabledBrush}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DisabledBorderBrush}" />
                            <Setter Property="Foreground">
                                <Setter.Value>
                                    <SolidColorBrush Color="{StaticResource DisabledForeground}"/>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="ArrowDown" Property="Fill">
                                <Setter.Value>
                                    <SolidColorBrush Color="{StaticResource DisabledForeground}"/>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="ArrowUp" Property="Fill">
                                <Setter.Value>
                                    <SolidColorBrush Color="{StaticResource DisabledForeground}"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <ControlTemplate x:Key="ComboBoxTextBox" TargetType="{x:Type TextBox}">
        <Border x:Name="PART_ContentHost" Focusable="False" Background="{TemplateBinding Background}" />
    </ControlTemplate>
    <Style x:Key="{x:Type ComboBox}" TargetType="{x:Type ComboBox}">
        <Setter Property="Background" Value="{StaticResource ControlLightBackground}"/>
        <Setter Property="Width" Value="Auto"/>
        <Setter Property="Height" Value="28"/>
        <Setter Property="FontFamily" Value="Calibri,Arial"/>
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="Padding" Value="4"/>
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="IsSynchronizedWithCurrentItem" Value="False"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel VirtualizingStackPanel.IsVirtualizing="True"/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBox}">
                    <Grid>
                        <ToggleButton x:Name="ToggleButton" Style="{StaticResource ComboBoxToggleButton}" Grid.Column="2" Focusable="False"
                                      IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"/>
                        <ContentPresenter x:Name="ContentSite" IsHitTestVisible="False" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                                          ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" Margin="6,3,32,3" VerticalAlignment="Center"
                                          HorizontalAlignment="Left"  />
                        <TextBox x:Name="PART_EditableTextBox" Style="{x:Null}" Template="{StaticResource ComboBoxTextBox}" HorizontalAlignment="Left" 
                                 VerticalAlignment="Center" Margin="6,3,32,3" Focusable="True" Background="Transparent" Visibility="Hidden" IsReadOnly="{TemplateBinding IsReadOnly}"/>
                        <Popup x:Name="Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False"
                               PopupAnimation="Slide" Margin="3,-8,-3,8">
                            <Grid x:Name="DropDown" SnapsToDevicePixels="True" MinWidth="{TemplateBinding ActualWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
                                <Border x:Name="DropDownBorder" Background="{StaticResource ControlLightBackground}" BorderThickness="1" CornerRadius="3" Margin="0,3,0,3"
                                        BorderBrush="{StaticResource ControlBorderBrush}"/>
                                <ScrollViewer Margin="0,3" SnapsToDevicePixels="True">
                                    <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                                </ScrollViewer>
                            </Grid>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasItems" Value="False">
                            <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground">
                                <Setter.Value>
                                    <SolidColorBrush Color="{StaticResource DisabledForeground}"/>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Background" Value="{StaticResource DisabledBrush}"/>
                            <Setter Property="Opacity" Value="0.72"/>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="True">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
                        </Trigger>
                        <Trigger SourceName="Popup" Property="AllowsTransparency" Value="True"/>
                        <Trigger Property="IsEditable" Value="True">
                            <Setter Property="IsTabStop" Value="False"/>
                            <Setter TargetName="PART_EditableTextBox" Property="Visibility"	Value="Visible"/>
                            <Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
                        </Trigger>
                        <Trigger Property="IsDropDownOpen" Value="True">
                            <Setter Property="BorderBrush" Value="{StaticResource ControlActiveBorderBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="{x:Type ComboBoxItem}" TargetType="{x:Type ComboBoxItem}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="HoverOn">
                            <ColorAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)"
                                            Duration="0:0:0.3" To="{StaticResource BorderBrushGradientColor2}"/>
                            <ColorAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)"
                                            Duration="0:0:0" To="{StaticResource HighlightComboBoxItem1}"/>
                            <ColorAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)"
                                            Duration="0:0:0" To="{StaticResource HighlightComboBoxItem2}"/>
                        </Storyboard>
                        <Storyboard x:Key="HoverOff">
                            <ColorAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)"
                                            Duration="0:0:0.3" To="#FFEEEFFF"/>
                            <ColorAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)"
                                            Duration="0:0:0" To="Transparent"/>
                            <ColorAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)"
                                            Duration="0:0:0" To="Transparent"/>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Border x:Name="Border" Padding="2" BorderThickness="1" SnapsToDevicePixels="True">
                        <Border.Background>
                            <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                <GradientStop Color="Transparent" Offset="0" />
                                <GradientStop Color="Transparent" Offset="1" />
                            </LinearGradientBrush>
                        </Border.Background>
                        <ContentPresenter x:Name="content"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsHighlighted" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOff}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{StaticResource DisabledForeground2}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- ProgressBar -->
    <Style TargetType="{x:Type ProgressBar}">
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}"/>
        <Setter Property="Background" Value="{StaticResource ControlLightBackground}"/>
        <Setter Property="Maximum" Value="100"/>
        <Setter Property="Height" Value="20"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ProgressBar}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="IndeterminateProgressBar" RepeatBehavior="Forever">
                            <ObjectAnimationUsingKeyFrames Duration="00:00:00" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="IndeterminateRoot">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Duration="00:00:00" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="DeterminateRoot">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(Brush.Transform).(TransformGroup.Children)[0].X" Storyboard.TargetName="IndeterminateGradientFill">
                                <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                                <SplineDoubleKeyFrame KeyTime="00:00:.35" Value="20"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid x:Name="Root">
                        <Border x:Name="PART_Track" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"/>
                        <Grid x:Name="ProgressBarRootGrid">
                            <Grid x:Name="IndeterminateRoot" Visibility="Collapsed">
                                <Rectangle x:Name="IndeterminateSolidFill" Margin="{TemplateBinding BorderThickness}" Opacity="1" RenderTransformOrigin="0.5,0.5" StrokeThickness="0" Fill="{StaticResource BrushTrackProgressBar}"/>
                                <Rectangle x:Name="IndeterminateGradientFill" Margin="{TemplateBinding BorderThickness}" Opacity="0.7" StrokeThickness="1" Fill="{StaticResource IndeterminateBrushProgressbar}"/>
                            </Grid>
                            <Grid x:Name="DeterminateRoot" Margin="1">
                                <Border x:Name="PART_Indicator" Background="{StaticResource BrushTrackProgressBar}" HorizontalAlignment="Left" Margin="-1">
                                    <Rectangle x:Name="GradientFill" Opacity="0.7" Visibility="Collapsed" Fill="{StaticResource IndeterminateBrushProgressbar}"/>
                                </Border>
                            </Grid>
                        </Grid>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Orientation" Value="Vertical">
                            <Setter Property="LayoutTransform" TargetName="Root">
                                <Setter.Value>
                                    <RotateTransform Angle="-90"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsIndeterminate" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource IndeterminateProgressBar}"/>
                            </Trigger.EnterActions>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Visibility" TargetName="DeterminateRoot" Value="Collapsed"/>
                            <Setter Property="Opacity" Value=".4" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderThickness" Value="1"/>
    </Style>

    <!-- ProgressBar с указанием процентов -->
    <Style TargetType="{x:Type ProgressBar}" x:Key="ProgressBarPercent">
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}"/>
        <Setter Property="Background" Value="{StaticResource ControlLightBackground}"/>
        <Setter Property="Maximum" Value="100"/>
        <Setter Property="Height" Value="20"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ProgressBar}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="IndeterminateProgressBar" RepeatBehavior="Forever">
                            <ObjectAnimationUsingKeyFrames Duration="00:00:00" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="IndeterminateRoot">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Duration="00:00:00" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="DeterminateRoot">
                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(Brush.Transform).(TransformGroup.Children)[0].X" Storyboard.TargetName="IndeterminateGradientFill">
                                <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                                <SplineDoubleKeyFrame KeyTime="00:00:.35" Value="20"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid x:Name="Root">
                        <Border x:Name="PART_Track" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"/>
                        <Grid x:Name="ProgressBarRootGrid">
                            <Grid x:Name="IndeterminateRoot" Visibility="Collapsed">
                                <Rectangle x:Name="IndeterminateSolidFill" Margin="{TemplateBinding BorderThickness}" Opacity="1" RenderTransformOrigin="0.5,0.5" StrokeThickness="0" Fill="{StaticResource BrushTrackProgressBar}"/>
                                <Rectangle x:Name="IndeterminateGradientFill" Margin="{TemplateBinding BorderThickness}" Opacity="0.7" StrokeThickness="1" Fill="{StaticResource IndeterminateBrushProgressbar}"/>
                            </Grid>
                            <Grid x:Name="DeterminateRoot" Margin="1">
                                <Border x:Name="PART_Indicator" Background="{StaticResource BrushTrackProgressBar}" HorizontalAlignment="Left" Margin="-1">
                                    <Rectangle x:Name="GradientFill" Opacity="0.7" Visibility="Collapsed" Fill="{StaticResource IndeterminateBrushProgressbar}"/>
                                </Border>
                            </Grid>
                            <Grid x:Name="GridValue" HorizontalAlignment="Center" VerticalAlignment="Center">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Label Grid.Column="0" Padding="0" Foreground="{TemplateBinding Foreground}" Content="{TemplateBinding Value}" Style="{x:Null}" />
                                <Label Grid.Column="1" Padding="0" Foreground="{TemplateBinding Foreground}" Content="%" Style="{x:Null}" />
                            </Grid>
                        </Grid>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Orientation" Value="Vertical">
                            <Setter Property="LayoutTransform" TargetName="Root">
                                <Setter.Value>
                                    <RotateTransform Angle="-90"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsIndeterminate" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource IndeterminateProgressBar}"/>
                            </Trigger.EnterActions>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value=".6" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderThickness" Value="1"/>
    </Style>

    <!-- ToolTip -->
    <Style TargetType="{x:Type ToolTip}">
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="HasDropShadow" Value="True"/>
        <Setter Property="Foreground" Value="{DynamicResource MyItemColor}"/>
        <Setter Property="FontStyle" Value="Italic"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToolTip}">
                    <Border x:Name="border_tooltip" Background="{StaticResource BackgroundToolTip}" BorderBrush="{StaticResource BorderBrushToolTip}" 
                            BorderThickness="2" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
                        <ContentPresenter Margin="5" HorizontalAlignment="Left" VerticalAlignment="Top" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasDropShadow" Value="true">
                            <Setter TargetName="border_tooltip" Property="CornerRadius" Value="5"/>
                            <Setter TargetName="border_tooltip" Property="SnapsToDevicePixels" Value="True"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="border_tooltip" Property="Background" Value="{StaticResource BackgroundToolTipDisabled}"/>
                            <Setter Property="Opacity" Value="0.82"/>
                            <Setter Property="Foreground" Value="#888"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- ResizeGrip -->
    <Style x:Key="{x:Type ResizeGrip}" TargetType="{x:Type ResizeGrip}">
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ResizeGrip}">
                    <Grid Background="Transparent" SnapsToDevicePixels="True">
                        <Path Data="M9,0L11,0 11,11 0,11 0,9 3,9 3,6 6,6 6,3 9,3z" Margin="0,0,2,2" HorizontalAlignment="Right" VerticalAlignment="Bottom">
                            <Path.Fill>
                                <DrawingBrush TileMode="Tile" Viewbox="0,0,3,3" Viewport="0,0,3,3" ViewportUnits="Absolute" ViewboxUnits="Absolute">
                                    <DrawingBrush.Drawing>
                                        <DrawingGroup>
                                            <GeometryDrawing Geometry="M0,0L2,0 2,2 0,2z">
                                                <GeometryDrawing.Brush>
                                                    <RadialGradientBrush GradientOrigin="0,0">
                                                        <GradientStop Color="#FFFFB900" Offset="1"/>
                                                    </RadialGradientBrush>
                                                </GeometryDrawing.Brush>
                                            </GeometryDrawing>
                                        </DrawingGroup>
                                    </DrawingBrush.Drawing>
                                </DrawingBrush>
                            </Path.Fill>
                        </Path>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- TabControl -->
    <Style TargetType="{x:Type TabControl}">
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}"/>
        <Setter Property="Padding" Value="4"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Background" Value="{StaticResource ControlBorderBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid ClipToBounds="True" SnapsToDevicePixels="True" KeyboardNavigation.TabNavigation="Local">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition x:Name="ColumnDefinition0"/>
                            <ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
                            <RowDefinition x:Name="RowDefinition1" Height="*"/>
                        </Grid.RowDefinitions>
                        <TabPanel Margin="0,0,0,0" x:Name="HeaderPanel" Grid.Column="0" Grid.Row="0" IsItemsHost="True" Panel.ZIndex="1" KeyboardNavigation.TabIndex="1"/>
                        <Border x:Name="ContentPanel" Grid.Column="0" Grid.Row="1" BorderBrush="{StaticResource ControlBorderBrush}" BorderThickness="0" CornerRadius="0,0,5,5" Background="{x:Null}">
                            <Border x:Name="InnerBd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" 
                                    KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local" CornerRadius="0,0,4,4">
                                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" x:Name="PART_SelectedContentHost" ContentSource="SelectedContent"/>
                            </Border>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground">
                                <Setter.Value>
                                    <SolidColorBrush Color="{StaticResource DisabledForeground}"/>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="BorderBrush" TargetName="ContentPanel" Value="{StaticResource DisabledBorderBrush}"/>
                            <Setter Property="Background" TargetName="InnerBd" Value="{StaticResource DisabledBrush}"/>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Bottom">
                            <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="1"/>
                            <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
                            <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                            <Setter Property="Height" TargetName="RowDefinition1" Value="Auto"/>
                            <Setter Property="Margin" TargetName="HeaderPanel" Value="2,0,2,2"/>
                            <Setter Property="CornerRadius" TargetName="ContentPanel" Value="5,5,5,0"/>
                            <Setter Property="CornerRadius" TargetName="InnerBd" Value="4,4,4,0"/>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Left">
                            <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
                            <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
                            <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="0"/>
                            <Setter Property="Grid.Column" TargetName="ContentPanel" Value="1"/>
                            <Setter Property="Width" TargetName="ColumnDefinition0" Value="Auto"/>
                            <Setter Property="Width" TargetName="ColumnDefinition1" Value="*"/>
                            <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                            <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
                            <Setter Property="Margin" TargetName="HeaderPanel" Value="0,2,2,2"/>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Right">
                            <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
                            <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
                            <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="1"/>
                            <Setter Property="Grid.Column" TargetName="ContentPanel" Value="0"/>
                            <Setter Property="Width" TargetName="ColumnDefinition0" Value="*"/>
                            <Setter Property="Width" TargetName="ColumnDefinition1" Value="Auto"/>
                            <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                            <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
                            <Setter Property="Margin" TargetName="HeaderPanel" Value="0,2,2,2"/>
                            <Setter Property="CornerRadius" TargetName="ContentPanel" Value="5,0,5,5"/>
                            <Setter Property="CornerRadius" TargetName="InnerBd" Value="4,0,4,4"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type TabItem}">
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusLine}"/>
        <Setter Property="Background" Value="{StaticResource TabControlItemBackgroundNormal}"/>
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}"/>
        <Setter Property="Padding" Value="10"/>
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}"/>
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="MinWidth" Value="10" />
        <Setter Property="MinHeight" Value="26" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate  TargetType="{x:Type TabItem}">
                    <ControlTemplate.Resources>
                        <Storyboard  x:Key="HoverOn">
                            <ColorAnimation Duration="0:0:0.3" Storyboard.TargetName="Content" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)"
                                            To="{StaticResource ColorForeground}"/>
                        </Storyboard>
                        <Storyboard x:Key="HoverOff">
                            <ColorAnimation Duration="0:0:0.3" Storyboard.TargetName="Content" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)"
                                            To="{StaticResource ColorForegroundWhite}"/>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid MinHeight="35"  Margin="0,0,0,0" HorizontalAlignment="Stretch" SnapsToDevicePixels="True" x:Name="grid" Background="Transparent" Height="auto" Width="auto">
                        <Border  x:Name="border_inner" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0"  
                                    Background="{TemplateBinding Background}">
                            <ContentPresenter  x:Name="Content" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                              ContentSource="Header" RecognizesAccessKey="True"  HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </Border>
                        <Border  x:Name="border_hover" Background="{StaticResource ControlBackgroundLine}" Opacity="0"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True"/>
                                <Condition Property="IsSelected" Value="False"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOff}"/>
                            </MultiTrigger.ExitActions>
                        </MultiTrigger>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter Property="Panel.ZIndex" Value="1"/>
                            <Setter Property="Background" TargetName="border_inner" Value="{StaticResource PressedBackgroundTabItem}"/>
                            <Setter Property="Foreground" Value="{StaticResource ControlForeground}"/>
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>
                            </Trigger.EnterActions>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Background" TargetName="border_inner" Value="{StaticResource DisabledBrush}"/>
                            <Setter Property="BorderBrush" TargetName="border_inner" Value="{StaticResource DisabledBorderBrush}"/>
                            <Setter Property="Foreground">
                                <Setter.Value>
                                    <SolidColorBrush Color="{StaticResource DisabledForeground}"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Left">
                            <Setter Property="LayoutTransform">
                                <Setter.Value>
                                    <RotateTransform Angle="-90"/>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Margin" Value="2,0,-2,0"/>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Right">
                            <Setter Property="LayoutTransform">
                                <Setter.Value>
                                    <RotateTransform Angle="90"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Bottom">
                            <Setter Property="BorderThickness" TargetName="border_inner" Value="1,0,1,1"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True"/>
                                <Condition Property="TabStripPlacement" Value="Top"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Margin" Value="-2,-2,-2,-1"/>
                            <Setter Property="Margin" TargetName="Content" Value="0,0,0,1"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True"/>
                                <Condition Property="TabStripPlacement" Value="Bottom"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Margin" Value="-2,-1,-2,-2"/>
                            <Setter Property="Margin" TargetName="Content" Value="0,1,0,0"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True"/>
                                <Condition Property="TabStripPlacement" Value="Left"/>
                            </MultiTrigger.Conditions>

                            <Setter Property="Margin" Value="-2,-2,-1,-2"/>
                            <Setter Property="Margin" TargetName="Content" Value="0,0,1,0"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="True"/>
                                <Condition Property="TabStripPlacement" Value="Right"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Margin" Value="-1,-2,-2,-2"/>
                            <Setter Property="Margin" TargetName="Content" Value="1,0,0,0"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Menu -->
    <Geometry x:Key="CheckMarker">M 0,5.1 L 1.7,5.2 L 3.4,7.1 L 8,0.4 L 9.2,0 L 3.3,10.8 Z</Geometry>
    <Geometry x:Key="RightArrow">M 0,0 L 4,3.5 L 0,7 Z</Geometry>

    <Style TargetType="{x:Type Menu}">
        <Setter Property="Background" Value="{StaticResource ControlBackgroundNormal}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}"/>
        <Setter Property="BorderThickness" Value="0,0,0,1"/>
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Menu}">
                    <Border SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                        <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" Value="{StaticResource DisabledBrush}"/>
                            <Setter Property="Opacity" Value="0.78"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type MenuItem}">
        <Setter Property="Foreground" Value="{StaticResource ControlForeground}"/>
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
        <Style.Triggers>
            <Trigger Property="Role" Value="TopLevelHeader">
                <Setter Property="Padding" Value="7,2,8,3"/>
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
            </Trigger>
            <Trigger Property="Role" Value="TopLevelItem">
                <Setter Property="Padding" Value="7,2,8,3"/>
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
            </Trigger>
            <Trigger Property="Role" Value="SubmenuHeader">
                <Setter Property="Padding" Value="2,3,2,3"/>
                <Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
            </Trigger>
            <Trigger Property="Role" Value="SubmenuItem">
                <Setter Property="Padding" Value="2,3,2,3"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    <ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
        <Grid SnapsToDevicePixels="True">
            <Rectangle Margin="0" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" RadiusX="1" RadiusY="1"/>
            <Rectangle Margin="0" x:Name="InnerBorderHeaderMenu"/>
            <DockPanel>
                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="4,0,4,0" x:Name="IconHeaderMenu" VerticalAlignment="Center" ContentSource="Icon"/>
                <Path x:Name="CheckMarkerMenuItem" Visibility="Collapsed" FlowDirection="LeftToRight" Margin="6,0,0,0"  VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{StaticResource CheckMarker}"/>
                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" ContentSource="Header" RecognizesAccessKey="True"/>
            </DockPanel>
            <Popup x:Name="PART_Popup" Focusable="False" AllowsTransparency="True" HorizontalOffset="1" IsOpen="{TemplateBinding IsSubmenuOpen}"
                   Placement="Bottom" PopupAnimation="Scroll" VerticalOffset="-1">
                <ContentControl IsTabStop="False" x:Name="SubmenuBorder" Template="{DynamicResource {ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}}">
                    <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="2" Grid.IsSharedSizeScope="True" KeyboardNavigation.DirectionalNavigation="Cycle" KeyboardNavigation.TabNavigation="Cycle"/>
                </ContentControl>
            </Popup>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsSuspendingPopupAnimation" Value="true">
                <Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
            </Trigger>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter Property="Visibility" TargetName="IconHeaderMenu" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Visibility" TargetName="CheckMarkerMenuItem" Value="Visible"/>
                <Setter Property="Visibility" TargetName="IconHeaderMenu" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsHighlighted" Value="True">
                <Setter Property="Fill" TargetName="InnerBorderHeaderMenu" Value="{StaticResource BackgroundHoverMenu}"/>
                <Setter Property="Stroke" TargetName="InnerBorderHeaderMenu" Value="{StaticResource BorderMenuItem}"/>
                <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}"/>
            </Trigger>
            <Trigger Property="IsSubmenuOpen" Value="True">
                <Setter Property="Fill" TargetName="InnerBorderHeaderMenu" Value="{StaticResource SelectedHeadermenu}"/>
                <Setter Property="Stroke" TargetName="InnerBorderHeaderMenu" Value="{StaticResource BorderMenuItem}"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{StaticResource DisabledForeground2}"/>
                <Setter Property="Fill" TargetName="CheckMarkerMenuItem" Value="Transparent"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}" TargetType="{x:Type ContentControl}">
        <Border Background="{StaticResource ControlLightBackground}" BorderBrush="{StaticResource BorderMenuItem}" BorderThickness="1">
            <Grid>
                <Rectangle HorizontalAlignment="Left" Margin="2" Width="28" Fill="{StaticResource IconBackgroundMenuItem}" RadiusX="2" RadiusY="2"/>
                <Rectangle HorizontalAlignment="Left" Margin="30,2,0,2" Width="1" Fill="Transparent"/>
                <Rectangle HorizontalAlignment="Left" Margin="31,2,0,2" Width="1" Fill="Transparent"/>
                <ContentPresenter Margin="2,0"/>
            </Grid>
        </Border>
    </ControlTemplate>
    <ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
        <Grid SnapsToDevicePixels="True">
            <Rectangle Margin="1" x:Name="BackgroundMenuItem" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" RadiusX="1" RadiusY="1"/>
            <Rectangle Margin="0" x:Name="InnerBorderHeaderMenu" RadiusX="2" RadiusY="2" />
            <DockPanel>
                <ContentPresenter x:Name="IconHeaderMenu" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="4,0,4,0" VerticalAlignment="Center" ContentSource="Icon"/>
                <Path x:Name="CheckMarkerMenuItem" Visibility="Collapsed" FlowDirection="LeftToRight" Margin="6,0,0,0"  VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{StaticResource CheckMarker}"/>
                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" ContentSource="Header" RecognizesAccessKey="True"/>
            </DockPanel>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter Property="Visibility" TargetName="IconHeaderMenu" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Visibility" TargetName="CheckMarkerMenuItem" Value="Visible"/>
                <Setter Property="Visibility" TargetName="IconHeaderMenu" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsHighlighted" Value="True">
                <Setter Property="Stroke" TargetName="InnerBorderHeaderMenu" Value="{StaticResource BorderMenuItem}"/>
                <Setter Property="Fill" TargetName="InnerBorderHeaderMenu" Value="Transparent"/>
                <Setter Property="Fill" TargetName="BackgroundMenuItem" Value="Transparent"/>
                <Setter Property="Foreground" Value="#eee"/>
            </Trigger>
            <Trigger Property="IsKeyboardFocused" Value="True">
                <Setter Property="Fill" TargetName="BackgroundMenuItem" Value="Transparent"/>
                <Setter Property="Stroke" TargetName="InnerBorderHeaderMenu" Value="{StaticResource BorderMenuItem}"/>
                <Setter Property="Fill" TargetName="InnerBorderHeaderMenu" Value="Transparent"/>
                <Setter Property="StrokeDashArray" TargetName="InnerBorderHeaderMenu" Value="1,2"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{StaticResource DisabledForeground2}"/>
                <Setter Property="Fill" TargetName="CheckMarkerMenuItem" Value="Transparent"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
        <Grid SnapsToDevicePixels="True">
            <Rectangle x:Name="BackgroundSubmenuItem" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" RadiusX="2" RadiusY="2"/>
            <Rectangle Margin="1" x:Name="InnerBorderSubmenuItem" RadiusX="2" RadiusY="2"/>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition MinWidth="24" Width="Auto" SharedSizeGroup="MenuItemIconColumnGroup"/>
                    <ColumnDefinition Width="4"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="37"/>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup"/>
                    <ColumnDefinition Width="17"/>
                </Grid.ColumnDefinitions>
                <ContentPresenter x:Name="IconSubmenu" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="1"  VerticalAlignment="Center" ContentSource="Icon"/>
                <Border Visibility="Hidden" Margin="1" x:Name="CheckedSubmenu" Width="22" Height="22" Background="Transparent">
                    <Path FlowDirection="LeftToRight" x:Name="PathCheckedSubmenu" Width="9" Height="11" Fill="{TemplateBinding Foreground}" Data="{StaticResource CheckMarker}"/>
                </Border>
                <ContentPresenter VerticalAlignment="Center"  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" Grid.Column="2" ContentSource="Header" RecognizesAccessKey="True"/>
                <TextBlock Margin="{TemplateBinding Padding}" Grid.Column="4" Text="{TemplateBinding InputGestureText}"/>
            </Grid>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter Property="Visibility" TargetName="IconSubmenu" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Visibility" TargetName="CheckedSubmenu" Value="Visible"/>
                <Setter Property="Visibility" TargetName="IconSubmenu" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsHighlighted" Value="True">
                <Setter Property="Fill" TargetName="BackgroundSubmenuItem" Value="{StaticResource BackgroundHoverSubmenu}"/>
                <Setter Property="Stroke" TargetName="BackgroundSubmenuItem" Value="{StaticResource BorderMenuItem}"/>
                <Setter Property="Stroke" TargetName="InnerBorderSubmenuItem" Value="#ddd"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{StaticResource DisabledForeground2}"/>
                <Setter Property="Fill" TargetName="PathCheckedSubmenu" Value="{StaticResource DisabledBrush}"/>
                <Setter Property="Opacity" TargetName="CheckedSubmenu" Value="0.72"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
        <Grid SnapsToDevicePixels="True">
            <Rectangle x:Name="BackgroundHeaderSubmenu" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" RadiusX="2" RadiusY="2"/>
            <Rectangle Margin="1" x:Name="InnerBorderHeaderSubmenu" Stroke="Transparent" StrokeThickness="1" RadiusX="2" RadiusY="2"/>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition MinWidth="24" Width="Auto" SharedSizeGroup="MenuItemIconColumnGroup"/>
                    <ColumnDefinition Width="4"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="37"/>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup"/>
                    <ColumnDefinition Width="17"/>
                </Grid.ColumnDefinitions>
                <ContentPresenter x:Name="IconHeaderSubmenu" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="1"  VerticalAlignment="Center" ContentSource="Icon"/>
                <Border x:Name="CheckedHeaderSubmenu" Visibility="Hidden" Margin="1"  Width="22" Height="22" Background="Transparent">
                    <Path x:Name="PathCheckedHeaderSubmenu" FlowDirection="LeftToRight"  Width="9" Height="11" Fill="{TemplateBinding Foreground}" Data="{StaticResource CheckMarker}"/>
                </Border>
                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" Grid.Column="2" ContentSource="Header" RecognizesAccessKey="True"/>
                <TextBlock Visibility="Collapsed" Margin="{TemplateBinding Padding}" Grid.Column="4" Text="{TemplateBinding InputGestureText}"/>
                <Path Margin="4,0,0,0" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Grid.Column="5" Data="{StaticResource RightArrow}"/>
            </Grid>
            <Popup x:Name="PART_Popup" Focusable="false" AllowsTransparency="True" HorizontalOffset="-2" IsOpen="{TemplateBinding IsSubmenuOpen}"
                   Placement="Right" PopupAnimation="Slide" VerticalOffset="-2" >
                <ContentControl x:Name="SubmenuBorder" IsTabStop="False" Template="{DynamicResource {ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}}" >
                    <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="2" Grid.IsSharedSizeScope="True" KeyboardNavigation.DirectionalNavigation="Cycle" KeyboardNavigation.TabNavigation="Cycle"/>
                </ContentControl>
            </Popup>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsSuspendingPopupAnimation" Value="True">
                <Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
            </Trigger>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter Property="Visibility" TargetName="IconHeaderSubmenu" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Visibility" TargetName="CheckedHeaderSubmenu" Value="Visible"/>
                <Setter Property="Visibility" TargetName="IconHeaderSubmenu" Value="Collapsed"/>
            </Trigger>
            <Trigger Property="IsHighlighted" Value="True">
                <Setter Property="Fill" TargetName="BackgroundHeaderSubmenu" Value="{StaticResource BackgroundHoverSubmenu}"/>
                <Setter Property="Stroke" TargetName="BackgroundHeaderSubmenu" Value="{StaticResource BorderMenuItem}"/>
                <Setter Property="Stroke" TargetName="InnerBorderHeaderSubmenu" Value="#ddd"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Foreground" Value="{StaticResource DisabledForeground2}"/>
                <Setter Property="Fill" TargetName="PathCheckedHeaderSubmenu" Value="{StaticResource DisabledBrush}"/>
                <Setter Property="Opacity" TargetName="CheckedHeaderSubmenu" Value="0.72"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}">
        <Setter Property="Height" Value="3"/>
        <Setter Property="Margin" Value="30,4,0,4"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Separator}">
                    <Border BorderBrush="{StaticResource BorderMenuItem}" BorderThickness="0,1,0,1" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- ContextMenu -->
    <Style TargetType="{x:Type ContextMenu}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Grid.IsSharedSizeScope" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ContextMenu}">
                    <Border x:Name="BorderContextMenu" Background="{StaticResource ControlLightBackground}" BorderBrush="{StaticResource ControlBorderBrush}" 
                            BorderThickness="2" CornerRadius="4" >
                        <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- ListBox -->
    <Style TargetType="{x:Type ListBox}">
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}"/>
        <Setter Property="Background" Value="{StaticResource ControlLightBackground}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBox}">
                    <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="4">
                        <ScrollViewer>
                            <ItemsPresenter Margin="4"/>
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" Value="{StaticResource DisabledBrush}" TargetName="border"/>
                            <Setter Property="BorderBrush" Value="{StaticResource DisabledBorderBrush}" TargetName="border"/>
                            <Setter Property="Foreground">
                                <Setter.Value>
                                    <SolidColorBrush Color="{StaticResource DisabledForeground}"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="True">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type ListBoxItem}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="HoverOn">
                            <ColorAnimation Duration="0:0:0.3" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="content"
                                            To="{StaticResource ColorForeground}"/>
                        </Storyboard>
                        <Storyboard x:Key="HoverOff">
                            <ColorAnimation Duration="0:0:0.3" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="content"
                                            To="{StaticResource ColorForegroundWhite}"/>
                        </Storyboard>
                        <Storyboard x:Key="SelectedOn">
                            <DoubleAnimation Duration="0:0:0.3" Storyboard.TargetName="selected_bg" Storyboard.TargetProperty="(UIElement.Opacity)"
                                             To="1"/>
                        </Storyboard>
                        <Storyboard x:Key="SelectedOff">
                            <DoubleAnimation Duration="0:0:0.3" Storyboard.TargetName="selected_bg" Storyboard.TargetProperty="(UIElement.Opacity)"
                                             To="0"/>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid Background="{TemplateBinding Background}" Margin="1,1,1,1" SnapsToDevicePixels="True" x:Name="grid">
                        <Rectangle x:Name="bg" IsHitTestVisible="False" Fill="Transparent"/>
                        <Rectangle x:Name="selected_bg" IsHitTestVisible="False" Opacity="0">
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Offset="0" Color="{StaticResource HighlightComboBoxItem1}"/>
                                    <GradientStop Offset="1" Color="{StaticResource HighlightComboBoxItem2}"/>
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <ContentPresenter x:Name="content" Margin="3" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True"/>
                                <Condition Property="IsSelected" Value="False"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOff}"/>
                            </MultiTrigger.ExitActions>
                        </MultiTrigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>
                                <BeginStoryboard Storyboard="{StaticResource SelectedOn}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource SelectedOff}"/>
                            </Trigger.ExitActions>
                            <Setter Property="Foreground" Value="{StaticResource ControlForeground}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground">
                                <Setter.Value>
                                    <SolidColorBrush Color="{StaticResource DisabledForeground}"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
    </Style>

    <!-- Slider -->
    <Style x:Key="HorizontalSliderThumb" TargetType="{x:Type Thumb}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Height" Value="18"/>
        <Setter Property="Width" Value="18"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="HoverOn">
                            <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="center" Storyboard.TargetProperty="(FrameworkElement.Height)">
                                <DoubleAnimation.To>
                                    <system:Double>10</system:Double>
                                </DoubleAnimation.To>
                            </DoubleAnimation>
                            <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="center" Storyboard.TargetProperty="(FrameworkElement.Width)">
                                <DoubleAnimation.To>
                                    <system:Double>10</system:Double>
                                </DoubleAnimation.To>
                            </DoubleAnimation>
                        </Storyboard>
                        <Storyboard x:Key="HoverOff">
                            <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="center" Storyboard.TargetProperty="(FrameworkElement.Height)">
                                <DoubleAnimation.To>
                                    <system:Double>14</system:Double>
                                </DoubleAnimation.To>
                            </DoubleAnimation>
                            <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="center" Storyboard.TargetProperty="(FrameworkElement.Width)">
                                <DoubleAnimation.To>
                                    <system:Double>14</system:Double>
                                </DoubleAnimation.To>
                            </DoubleAnimation>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid Background="Transparent">
                        <Ellipse Stretch="Fill" Fill="{StaticResource ControlForegroundWhite}"/>
                        <Ellipse x:Name="center" Width="14" Height="14" VerticalAlignment="Center" HorizontalAlignment="Center" Fill="{StaticResource ControlActiveBorderBrush}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOff}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Fill" TargetName="center" Value="{StaticResource DisabledBrush}"/>
                            <Setter Property="Opacity" Value=".8"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="RepeatButtonLeft" TargetType="{x:Type RepeatButton}" BasedOn="{x:Null}">
        <Setter Property="Height" Value="6"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Grid>
                        <Border x:Name="bg" Background="{StaticResource BrushTrackProgressBar}" CornerRadius="2"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" TargetName="bg" Value="{StaticResource DisabledBrush}"/>
                            <Setter Property="Opacity" Value=".8"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="RepeatButtonRight" TargetType="{x:Type RepeatButton}" BasedOn="{x:Null}">
        <Setter Property="Height" Value="6"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Grid>
                        <Border x:Name="bg" Background="{DynamicResource MyBackground}" CornerRadius="2"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" TargetName="bg" Value="{StaticResource DisabledBrush}"/>
                            <Setter Property="Opacity" Value=".8"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type Slider}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="{StaticResource ControlForeground}"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusLine2}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Slider}">
                    <Grid x:Name="GridRoot">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <TickBar Visibility="Collapsed" x:Name="TopTick" Height="5" SnapsToDevicePixels="True" Placement="Top" Fill="{TemplateBinding Foreground}"/>
                        <Border Grid.Row="1" Margin="0" x:Name="Border" Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2"/>
                        <Canvas Grid.Row="1" VerticalAlignment="Center" Margin="0,-2,0,4">
                            <Rectangle Fill="{StaticResource SliderSelectRange}" x:Name="PART_SelectionRange" Height="6" Visibility="Hidden" />
                        </Canvas>
                        <Track Grid.Row="1" x:Name="PART_Track">
                            <Track.Thumb>
                                <Thumb x:Name="thumb" Style="{StaticResource HorizontalSliderThumb}"/>
                            </Track.Thumb>
                            <Track.IncreaseRepeatButton>
                                <RepeatButton x:Name="LeftRB" Style="{DynamicResource RepeatButtonRight}" Command="Slider.IncreaseLarge"/>
                            </Track.IncreaseRepeatButton>
                            <Track.DecreaseRepeatButton>
                                <RepeatButton x:Name="RightRB" Style="{DynamicResource RepeatButtonLeft}" Command="Slider.DecreaseLarge"/>
                            </Track.DecreaseRepeatButton>
                        </Track>
                        <TickBar Visibility="Collapsed" Grid.Row="2" x:Name="BottomTick" Height="5" SnapsToDevicePixels="True" Placement="Bottom" Fill="{TemplateBinding Foreground}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TickPlacement" Value="TopLeft">
                            <Setter Property="Visibility" Value="Visible" TargetName="TopTick"/>
                        </Trigger>
                        <Trigger Property="TickPlacement" Value="BottomRight">
                            <Setter Property="Visibility" Value="Visible" TargetName="BottomTick"/>
                        </Trigger>
                        <Trigger Property="TickPlacement" Value="Both">
                            <Setter Property="Visibility" Value="Visible" TargetName="TopTick"/>
                            <Setter Property="Visibility" Value="Visible" TargetName="BottomTick"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{StaticResource DisabledForeground2}"/>
                            <Setter Property="Opacity" Value="0.62"/>
                        </Trigger>
                        <Trigger Property="Orientation" Value="Vertical">
                            <Setter Property="LayoutTransform" TargetName="GridRoot">
                                <Setter.Value>
                                    <RotateTransform Angle="-90"/>
                                </Setter.Value>
                            </Setter>
                            <Setter TargetName="PART_Track" Property="Orientation" Value="Horizontal"/>
                        </Trigger>
                        <Trigger Property="IsSelectionRangeEnabled" Value="True">
                            <Setter Property="Visibility" TargetName="PART_SelectionRange" Value="Visible"/>
                            <Setter Property="Opacity" TargetName="LeftRB" Value="0.8"/>
                            <Setter Property="Opacity" TargetName="RightRB" Value="0.8"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderThickness" Value="1,1,1,1"/>
    </Style>
    
    <!-- ListView -->
    <!-- ListView -->
    <Style TargetType="{x:Type ListView}">
        <Setter Property="Background" Value="{StaticResource ControlLightBackground}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.CanContentScroll" Value="True" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListView}">
                    <Border x:Name="Bd" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2" 
                            BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
                        <ScrollViewer Padding="{TemplateBinding Padding}" Style="{DynamicResource {x:Static GridView.GridViewScrollViewerStyleKey}}">
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsGrouping" Value="True">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="False" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource DisabledBrush}" />
                            <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource DisabledBorderBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="{x:Static GridView.GridViewScrollViewerStyleKey}" TargetType="{x:Type ScrollViewer}">
        <Setter Property="Focusable" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid SnapsToDevicePixels="True" Background="{TemplateBinding Background}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <DockPanel Margin="{TemplateBinding Padding}">
                            <ScrollViewer Focusable="False" DockPanel.Dock="Top" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
                                <GridViewHeaderRowPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="2,0,2,0" 
                                                            AllowsColumnReorder="{Binding TemplatedParent.View.AllowsColumnReorder, RelativeSource={RelativeSource TemplatedParent}}" 
                                                            ColumnHeaderContainerStyle="{Binding TemplatedParent.View.ColumnHeaderContainerStyle, RelativeSource={RelativeSource TemplatedParent}}" 
                                                            ColumnHeaderContextMenu="{Binding TemplatedParent.View.ColumnHeaderContextMenu, RelativeSource={RelativeSource TemplatedParent}}" 
                                                            ColumnHeaderTemplate="{Binding TemplatedParent.View.ColumnHeaderTemplate, RelativeSource={RelativeSource TemplatedParent}}" 
                                                            ColumnHeaderTemplateSelector="{Binding TemplatedParent.View.ColumnHeaderTemplateSelector, RelativeSource={RelativeSource TemplatedParent}}" 
                                                            ColumnHeaderToolTip="{Binding TemplatedParent.View.ColumnHeaderToolTip, RelativeSource={RelativeSource TemplatedParent}}" 
                                                            Columns="{Binding TemplatedParent.View.Columns, RelativeSource={RelativeSource TemplatedParent}}" />
                            </ScrollViewer>
                            <ScrollContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" x:Name="PART_ScrollContentPresenter"
                                                    Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" 
                                                    CanContentScroll="{TemplateBinding CanContentScroll}" KeyboardNavigation.DirectionalNavigation="Local" />
                        </DockPanel>
                        <ScrollBar Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Cursor="Arrow" x:Name="PART_HorizontalScrollBar"
                                   Grid.Row="1" Orientation="Horizontal" ViewportSize="{TemplateBinding ViewportWidth}" Maximum="{TemplateBinding ScrollableWidth}" 
                                   Minimum="0.0" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
                        <ScrollBar Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Cursor="Arrow" x:Name="PART_VerticalScrollBar" 
                                   Grid.Column="1" Orientation="Vertical" ViewportSize="{TemplateBinding ViewportHeight}" Maximum="{TemplateBinding ScrollableHeight}" 
                                   Minimum="0.0" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
                        <DockPanel Grid.Column="1" Grid.Row="1" Background="{Binding Background, ElementName=PART_VerticalScrollBar}" LastChildFill="False">
                            <Rectangle Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Width="1" Fill="White" DockPanel.Dock="Left" />
                            <Rectangle Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Height="1" Fill="White" DockPanel.Dock="Top" />
                        </DockPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ListViewItemFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Stroke="{StaticResource ControlActiveBorderBrush}" StrokeDashArray="1 2" StrokeThickness="1.5" RadiusX="2" RadiusY="2" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type ListViewItem}">
        <Setter Property="FocusVisualStyle" Value="{DynamicResource ListViewItemFocusVisual}" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type ListView}, Mode=FindAncestor}}"/>
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Margin" Value="0,0,0,1" />
        <Setter Property="Padding" Value="5,2" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListViewItem}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="HoverOn">
                            <ColorAnimation Duration="0:0:0.2" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="row_content"
                                            To="{StaticResource ColorForeground}"/>
                        </Storyboard>
                        <Storyboard x:Key="HoverOff">
                            <ColorAnimation Duration="0:0:0.2" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="row_content"
                                            To="{StaticResource ColorForegroundWhite}"/>
                        </Storyboard>
                        <Storyboard x:Key="SelectedOn">
                            <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="HoverSelected" To="1"/>
                        </Storyboard>
                        <Storyboard x:Key="SelectedOff">
                            <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="HoverSelected" To="0"/>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Border SnapsToDevicePixels="True" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2" x:Name="border">
                        <Grid Margin="2,0">
                            <Rectangle x:Name="Background" IsHitTestVisible="False" Fill="{TemplateBinding Background}" RadiusX="0"
                                       Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}"/>
                            <Rectangle x:Name="HoverSelected" IsHitTestVisible="False" Opacity="0" RadiusX="0">
                                <Rectangle.Fill>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Offset="0" Color="{StaticResource HighlightComboBoxItem1}"/>
                                        <GradientStop Offset="1" Color="{StaticResource HighlightComboBoxItem2}"/>
                                    </LinearGradientBrush>
                                </Rectangle.Fill>
                            </Rectangle>
                            <Border Background="Transparent">
                                <GridViewRowPresenter x:Name="row_content" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Stretch" Margin="0,2" />
                            </Border>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource SelectedOn}"/>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource SelectedOff}"/>
                            </Trigger.ExitActions>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True" />
                                <Condition Property="Selector.IsSelected" Value="False" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOff}"/>
                            </MultiTrigger.ExitActions>
                        </MultiTrigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground">
                                <Setter.Value>
                                    <SolidColorBrush Color="{StaticResource DisabledForeground3}"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="GridViewColumnHeaderGripper" TargetType="{x:Type Thumb}">
        <Setter Property="Canvas.Right" Value="-8.5" />
        <Setter Property="Width" Value="18" />
        <Setter Property="Height" Value="{Binding ActualHeight, RelativeSource={RelativeSource TemplatedParent}}" />
        <Setter Property="Padding" Value="0,3,0,4" />
        <Setter Property="Background" Value="{StaticResource ControlForegroundWhite}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Padding="{TemplateBinding Padding}" Background="#00FFFFFF">
                        <Rectangle HorizontalAlignment="Center" Width=".5" Fill="White"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="{x:Type GridViewColumnHeader}" TargetType="{x:Type GridViewColumnHeader}">
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                    <GradientStop Offset="0" Color="{StaticResource HighlightComboBoxItem1}"/>
                    <GradientStop Offset="1" Color="{StaticResource HighlightComboBoxItem2}"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Foreground" Value="{StaticResource ControlForeground}"/>
        <Setter Property="MinHeight" Value="24"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="HoverOn">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="HoverBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="HoverOff">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="HoverBorder" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="PressedOn">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Main" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value=".8"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="PressedOff">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Main" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid Margin="0,1">
                        <Grid>
                            <Border x:Name="Main" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" 
                                    Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderThickness}" CornerRadius="0" />
                            <Border x:Name="HoverBorder" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" 
                                    Background="{StaticResource ControlBackgroundLine}" BorderBrush="{x:Null}" CornerRadius="0" Opacity="0" />
                            <Border BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" BorderBrush="{StaticResource ControlForegroundWhite}">
                                <ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                  RecognizesAccessKey="True" Margin="2" />
                            </Border>
                        </Grid>
                        <Canvas>
                            <Thumb x:Name="PART_HeaderGripper" Style="{StaticResource GridViewColumnHeaderGripper}" HorizontalAlignment="Stretch" />
                        </Canvas>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOff}" x:Name="HoverOff_BeginStoryboard"/>
                            </Trigger.ExitActions>
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>
                            </Trigger.EnterActions>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Trigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource PressedOff}" x:Name="PressedOff_BeginStoryboard"/>
                            </Trigger.ExitActions>
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource PressedOn}" x:Name="PressedOn_BeginStoryboard"/>
                            </Trigger.EnterActions>
                        </Trigger>
                        <Trigger Property="Height" Value="Auto">
                            <Setter Property="MinHeight" Value="24" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{StaticResource DisabledForeground2}" />
                            <Setter Property="Opacity" TargetName="Main" Value=".6"/>
                        </Trigger>
                        <Trigger Property="Role" Value="Padding">
                            <Setter TargetName="PART_HeaderGripper" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <Trigger Property="Role" Value="Floating">
                            <Setter TargetName="PART_HeaderGripper" Property="Visibility" Value="Collapsed" />
                            <Setter Property="Foreground" Value="{StaticResource ControlForegroundWhite}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="{x:Static ToolBar.ComboBoxStyleKey}" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}"/>
    <Style x:Key="{x:Static ToolBar.TextBoxStyleKey}" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}"/>

</ResourceDictionary>